﻿using StarryEdge.Core.Manager;
using StarryEdge.UserCore.Model;
using StarryEdge.UserCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Prism.Commands;
using System.Runtime.Serialization;
using static System.Net.Mime.MediaTypeNames;

namespace StarryEdge.Module.DataReport.ViewModels
{
    public class SettingParameterViewModel
    {
        public SettingModel Setting { get; set; }
        public TestModel Test { get; set; }
        private IObjectManager _objectManager;
        public SettingParameterViewModel(IObjectManager objectManager)
        {
            Setting = new SettingModel();
            Test = new TestModel();
            objectManager.CopyObject<ISettingParameter, SettingModel>(Setting);
            objectManager.CopyObject<ISettingParameter, TestModel>(Test);
            _objectManager = objectManager;
        }

        public DelegateCommand Save => new DelegateCommand(() =>
        {
            _objectManager.UpdateObject<ISettingParameter, SettingModel>(Setting);
            _objectManager.UpdateObject<ISettingParameter, TestModel>(Test);
        });
    }
}
